package com.yc.class_attendance.wideget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.WindowManager;
import android.widget.TextView;

import com.yc.class_attendance.R;


/**
 * Created by Administrator on 2016-06-01.
 */
public class SignDialog extends Dialog {
    public SignDialog(Context context) {
        super(context);
    }

    public SignDialog(Context context, int theme) {
        super(context, theme);
    }

    public static SignDialog show(Context context, String content, String url) {
        SignDialog dialog = new SignDialog(context, R.style.sign_diglog);
        dialog.setTitle("");
        dialog.setContentView(R.layout.sign_dialog);
        ((TextView) dialog.findViewById(R.id.tv_message)).setText(content);
//        ImageView spinnerImageView = (ImageView) dialog.findViewById(R.id.spinnerImageView);
        //Glide.with(context).load(url).into(spinnerImageView);
        // 按返回键是否取消
        dialog.setCancelable(true);
        dialog.setCanceledOnTouchOutside(true);
        // 监听返回键处理
        //dialog.setOnCancelListener(cancelListener);
        // 设置居中
        dialog.getWindow().getAttributes().gravity = Gravity.CENTER;
        WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        // 设置背景层透明度
//        lp.dimAmount = 0.2f;
        dialog.getWindow().setAttributes(lp);
        dialog.show();

        return dialog;
    }


}